package main

import (
	"fmt"
	"math/rand"
	"time"
)

var genders = []string{"男", "女"}

type Gender int

const (
	Male Gender = iota
	Female
)

var edus = []string{"小学", "初中", "高中", "大专", "本科", "硕士", "博士"}

type Edu int

const (
	PrimarySchool Edu = iota
	MiddleSchool
	HighSchool
	college
	BachelorDegree
	MasterDegree
	DoctoralDegree
)

type Person struct {
	Name   string
	Gender Gender
	Age    int
	Edu    Edu
}

//func (p Person) String() string {
//	d := make(map[string]interface{})
//	fmt.Printf()
//}
//随机生成耨个姓名的性别，年龄，学历
func main() {
	for {
		var name string
		fmt.Scan(&name)
		fmt.Printf("输入姓名：%s\n", name)
		if name == "exit" {
			return
		}
		gender, age, edu := GeneratePerson(name)
		dPerson := make(map[string]interface{})
		dPerson["name"] = name
		dPerson["gender"] = genders[gender]
		dPerson["age"] = age
		dPerson["edu"] = edus[edu]
		fmt.Println(dPerson)
	}

}

func GeneratePerson(name string) (gender Gender, age int, edu Edu) {
	rand.Seed(time.Now().UnixNano())
	gender = Gender(rand.Intn(2)) //随机生成0-1之间的数
	age = rand.Intn(10) + 18
	edu = Edu(rand.Intn(7))

	return
}
